package handler

import (
	"choujiang/common/models"
	"choujiang/common/utils"
	"choujiang/common/consts"
	"github.com/gin-gonic/gin"
	"encoding/json"
)

func GetRanking(c *gin.Context) {
	form := c.Request.Form
	uniqueId := form.Get("uniqueId")
	user := model.GetUserByUniqueId(uniqueId)
	if user == nil {
		utils.Error(consts.ErrUserNotFound, c)
		return
	}
	ret := make(map[string]interface{})
	var dat []map[string]interface{}
	jsonStr := `[]`
	json.Unmarshal([]byte(jsonStr), &dat)
	ret["weekly"] = dat
	ret["my_weekly"] = 15
	ret["monthly"] = dat
	ret["my_monthly"] = nil
	utils.JSON(ret, c)
}
